package com.x.chalk.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.x.chalk.entity.UserSign;
import com.x.chalk.vo.R;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface UserSignDao extends BaseMapper<UserSign> {
    /**查询用户最后一次签到记录*/
    @Select("select * from t_usersign where uid=#{uid} order by ctime desc limit 1")
    UserSign selectLast(long uid);

    /**查询用户连续签到天数*/
    @Select("select days from t_usersign where uid=#{uid} order by ctime desc limit 1")
    int queryDays(long uid);

    /**查询用户累计签到天数*/
    @Select("select accumulateddays from t_usersign where uid=#{uid} order by ctime desc limit 1")
    int queryAccumulatedDays(long uid);
}
